import 'package:flutter/material.dart';

/*
* 路由传值：
*
* */

//创建一个widget。继承自StatelessWidget
class TipRoute extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //获取路由参数
    var args = ModalRoute.of(context).settings.arguments;
    return Scaffold(
      appBar: AppBar(
        title: Text("我这是在接收一个参数"),
      ),
      body: Padding(padding: EdgeInsets.all(18),
      child: Center(
          child:Column(
            children: <Widget>[
              Text(args),
              RaisedButton(
                //关闭页面带回返回值
                onPressed: () => Navigator.pop(context,"我是带回的返回值"),
                child: Text("返回到上个页面"),
              )
            ],
          )
      ),
      ),

    );
  }
}
